<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich" 
	xml:lang="en" lang="en">
	
	<ui:composition>
		
		<!-- PAINEL MODAL  DE SELEÇÃO -->
		<rich:modalPanel id="#{idPanel}" autosized="true" width="600">

			<f:facet name="header">
				<h:outputText value="#{descricaoPesquisa}" />
			</f:facet>
			<f:facet name="controls">
				<h:panelGroup>
					<h:graphicImage value="/imagens/close.png" id="hidelink_#{idPanel}" styleClass="hidelink" />
					<rich:componentControl for="#{idPanel}" attachTo="hidelink_#{idPanel}" operation="hide" event="onclick" />
				</h:panelGroup>
			</f:facet>

			<!-- FORMULARIO DO PAINEL MODAL -->
			<h:form>
				<rich:messages style="color:red;" />
					<a4j:outputPanel id="outputPanel_#{idPanel}" ajaxRendered="true" style="width: 100%;">

						<rich:panel style="width: 100%;">
							<h:outputText value="#{descricaoPesquisa} : " />
							<h:inputText value="#{backingBean[campoPesquisa]}" style="width: 400" />
							<a4j:commandButton value="Pesquisar" action="#{backingBean[metodoPesquisa]}"/>
						</rich:panel>

						<rich:dataTable value="#{backingBean[metodoListaObjetos]}" var="objeto" rows="10" id="tabelaPesquisa_#{idPanel}" width="100%;">

							<!--  COLUNA : ACOES -->
							<rich:column width="20px;">

								<f:facet name="header">
									<h:outputText value="Ações" />
								</f:facet>

								<a4j:commandLink ajaxSingle="true" 
																	id="selectLink_#{idPanel}" 
																	oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component(idPanel)}.hide();"
																	reRender="#{campoReRenderizar}">

										<h:graphicImage value="/imagens/select.png" style="border: 0;" />
									<f:setPropertyActionListener target="#{backingBean[metodoObjetoSelecionado]}" value="#{objeto}" />

								</a4j:commandLink>
								<rich:toolTip for="selectLink_#{idPanel}" value="Selecionar" />

							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Descrição" />
								</f:facet>

								<h:outputText value="#{objeto[metodoDescricao]}" />

							</rich:column>

						</rich:dataTable>

						<!--  <rich:message showSummary="true" showDetail="false" for="price" />-->
						<h:messages style="color:red" />
					</a4j:outputPanel>

			</h:form>

		</rich:modalPanel>



	</ui:composition>
	
	
</html>
